<?php


/** ensure this file is being included by a parent file */
defined('_JEXEC') or die('Restricted access');
?>

		<?php
		echo "<form action='{$this->formAction}' method='post' name='adminForm' id='adminForm'>";
		?>
		<table class="adminheading">
		<tr>
            <th class='helpdesk_users'>
            <?php echo HelpDeskText::_( 'Select User' ); ?>
            </th>            
          <td class='right'>
          	<?php echo HelpDeskText::_( 'Search' ); ?>:
          </td>
          <td class="input">
          	<?php echo $this->search; ?>
          </td>
      		<?php
				for ($f=0; $f<count($this->filterLists); $f++) {
		          	echo "<td class='right'>";
					echo $this->filterLists[$f];
					echo "</td>";
				}
			?>
		</tr>
		</table>

		<table class="adminlist">
		<thead>
            <tr>
                <th class="title">
                <?php echo HelpDeskHTML::sortList( HelpDeskText::_( 'ID' ), "id", $this->order_dir, $this->order, HelpDeskRequest::getVar( 'task' ) ); ?>
                </th>                
                <th class="title">
                <?php echo HelpDeskHTML::sortList( HelpDeskText::_( 'Name' ), "name", $this->order_dir, $this->order, HelpDeskRequest::getVar( 'task' ) ); ?>
                </th>
                <th class="title">
                <?php echo HelpDeskHTML::sortList( HelpDeskText::_( 'Username' ), "username", $this->order_dir, $this->order, HelpDeskRequest::getVar( 'task' ) ); ?>
                </th>
                <th class="title">
                <?php echo HelpDeskHTML::sortList( HelpDeskText::_( 'Email' ), "email", $this->order_dir, $this->order, HelpDeskRequest::getVar( 'task' ) ); ?>
                </th>
                <th class="title">
	            <?php echo HelpDeskText::_( 'Action' ); ?>
                </th>
            </tr>
		</thead>
        <tbody>
		<?php
        $k = 0;
		$today 			= date( "Y-m-d" );
		$yesterday_time	= time() - (24 * 60 * 60); // timestamp - 24 hours * 60 mins * 60secs
		$yesterday		= date( "Y-m-d", $yesterday_time ); 
        for ($i=0, $n=count( $this->items ); $i < $n; $i++)
        {
            $row 		=& $this->items[$i];
			$checked    = HelpDeskHTML::gridId( $i, $row->id );
			$link 		= HelpDeskRoute::_( 'index2.php?option='.$option.'&controller=tickets&task=new&userid='. $row->id );
			?>
				<tr class="<?php echo "row$k"; ?>">
					<td>
						<?php echo $row->id; ?>
					</td>
					<td>
						<a href="index2.php?option=com_users&task=view&search=<?php echo $row->username; ?>" title="<?php echo HelpDeskText::_( 'Edit' ); ?>">
						<?php echo $row->name; ?>
						</a>
					</td>
					<td>
						<a href='index2.php?option=com_users&task=view&search=<?php echo $row->username; ?>'>
						<?php echo $row->username; ?>
						</a>
					</td>
					<td>
						<?php echo $row->email; ?>
					</td>
					<td>
						<a href='<?php echo $link; ?>'>
						<img src="images/next_f2.png" border="0" width="18" height="18" alt="<?php echo HelpDeskText::_( 'Select' ); ?>" title="<?php echo HelpDeskText::_( 'Select' ); ?>" name="<?php echo HelpDeskText::_( 'Select' ); ?>" />
						</a>
					</td>
				</tr>
        <?php 
        $k = 1 - $k;
        }
        ?>
        </tbody>
        <tfoot>
        	<tr>
                <td colspan='10'>
                    <div class="pagination">
                    <?php echo $this->pagination->getListFooter(); ?>
                    </div>            
                </td>
            </tr>
        </tfoot>

		</table>
                
		<input type="hidden" name="option" value="<?php echo $this->formOption; ?>" />
		<input type="hidden" name="controller" value="<?php echo $this->formController; ?>" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="id" value="" />
		<input type="hidden" name="boxchecked" value="" />
		<input type="hidden" name="order" value="<?php echo $this->order; ?>" />
		<input type="hidden" name="order_dir" value="<?php echo $this->order_dir; ?>" />
        
		<?php
		echo $this->formValidate;
		echo "</form>";
		?>